From e9b25787faeae68dbd0533480ab7806c0963d8c5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 1 Jul 2014 07:55:19 -0700 Subject: [PATCH] Enable execution without cargo in PATH This allows usage of cargo without all the executables in your PATH, you only need to be able to reach the first one. --- src/bin/cargo.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index ed3a12d32..c3577bdd8 100755 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -56,7 +56,12 @@ fn execute() { println!("Options (for all commands):\n\n{}", options); }, _ => { - let command = Command::new(format!("cargo-{}", cmd)) + let command = format!("cargo-{}", cmd); + let mut command = match os::self_exe_path() { + Some(path) => Command::new(path.join(command)), + None => Command::new(command), + }; + let command = command .args(args.as_slice()) .stdin(InheritFd(0)) .stdout(InheritFd(1)) -- 2.30.2